#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        vector<int> ret;
        int pre = 0;
        int cur = price.size() - 1;
        while (price[cur] > target)
        {
            cur--;
        }
        while (price[pre] + price[cur] != target)
        {
            if (price[pre] + price[cur] > target)
            {
                cur--;
                pre = 0;
            }
            else
            {
                pre++;
            }
        }
        ret.push_back(price[pre]);
        ret.push_back(price[cur]);
        return ret;

    }
};